// const Koa = require('koa');
// const serve = require('koa-static');
// const Router = require('@koa/router');
import Koa from 'koa';
import serve from 'koa-static';
import Router from '@koa/router';

const app = new Koa();
const router = new Router();

router.get('/', (ctx, next) => {
    ctx.body = `
        <!DOCTYPE html>
        <html lang="en">
            <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>React SSR</title>
            </head>
            <body>
                <div id="root"></div>
                <script src="bundle.js"></script>
            </body>
        </html>
    `;
});

app.use(router.routes()).use(router.allowedMethods());
app.use(serve('dist'));

app.listen(3000, () => {
    console.log('server is running http://localhost:3000');
})